package com.huawei.hms.framework.network.restclient.hwhttp.urlconnection;

import com.huawei.hms.framework.network.restclient.Headers;
import com.huawei.hms.framework.network.restclient.hianalytics.RequestFinishedInfo;
import com.huawei.hms.framework.network.restclient.hwhttp.RequestTask;
import com.huawei.hms.framework.network.restclient.hwhttp.Response;

public class URLConnEventListenerImpl {
    private URLConnRequestFinishedInfo requestFinishedInfo = new URLConnRequestFinishedInfo();

    URLConnEventListenerImpl() {
    }

    void callStart(String str) {
        this.requestFinishedInfo.setUrl(str);
        this.requestFinishedInfo.getMetricsTime().setCallStartTime();
        this.requestFinishedInfo.getMetricsRealTime().setCallStartTime();
    }

    void openConnectionStart(String str) {
    }

    void openConnectionEnd(String str, String str2, String str3, RequestTask requestTask) {
    }

    void requestHeaderStart() {
    }

    void requestHeaderEnd() {
    }

    void requestBodyStart() {
    }

    void requestBodyEnd(long j) {
        this.requestFinishedInfo.getMetrics().setRequestByteCount(j);
    }

    void responseBodyStart() {
    }

    void responseBodyEnd(long j) {
        this.requestFinishedInfo.getMetrics().setResponseByteCount(j);
    }

    void responseHeaderStart() {
    }

    void responseHeaderEnd(Headers headers) {
    }

    void callEnd(Response response) {
        this.requestFinishedInfo.getMetricsTime().setCallEndTime();
        this.requestFinishedInfo.getMetricsRealTime().setCallEndTime();
    }

    void callFailed(Exception exception) {
        this.requestFinishedInfo.setException(exception);
        this.requestFinishedInfo.getMetricsTime().setCallEndTime();
        this.requestFinishedInfo.getMetricsRealTime().setCallEndTime();
    }

    public RequestFinishedInfo getRequestFinishedInfo() {
        return this.requestFinishedInfo;
    }
}
